﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace DiagramCreator
{
	/// <summary>
	/// Interaction logic for SplitButton.xaml
	/// </summary>
	public partial class SplitButton
	{
		public SplitButton()
		{
			this.InitializeComponent();
            this.DropDownButton.Click += new RoutedEventHandler(DropDownButton_Click);            
		}

        /// <summary>
        /// Main Button Content
        /// </summary>
        public object ButtonContent
        {
            get
            {
                return this.MainButton.Content;
            }
            set
            {
                this.MainButton.Content = value;
            }
        }

        /// <summary>
        /// Sub Buttons Set (via drop-down)
        /// </summary>
        public UIElementCollection SubButtons
        {
            get
            {
                return this.DropDownButtonsStackPanel.Children;
            }
        }

        void DropDownButton_Click(object sender, RoutedEventArgs e)
        {
            if (!DropDownButtons.IsOpen)
            {
                DropDownButtons.IsOpen = true;
            }
            else
            {
                DropDownButtons.IsOpen = false;
            }
        }
	}
}